Section: Proxies
The section Proxies
defines a function block which implements the proxy.
A proxy serves for data exchange of modules of different application. The instance of the proxy FB represents the module instance in a remote application.
SEC Proxies //optional: yes, modifier: [UPDATE] SEC Proxy : <identifier> //optional: yes, modifier [UPDATE] FB := <FB name>; //optional: no, type: QID SEC MirrorVar : <identifier> //optional: yes, modifier [UPDATE]) Variable := <variable name>; //optional: no, type: VarPath END_SEC SEC ProxyParameter : <target> // optional: yes, modifier [UPDATE] Variable := <InstancePath>; // optional: no, type: VarPath END_SEC END_SEC END_SEC
Details regarding the syntax of definition types are described in the section Module Declaration.
The function block must derive from
IBaseInstance
.The function block must have a method
SetProxyIdentification
with the following signature, which is not included in the InterfaceIBaseInstance
:SetProxyIdentification(pbyName : POINTER TO BYTE, udiComAddr : UDINT, udiLocalComAddr : UDINT, pEnvironment : MEnv)
The passed instance name and the set address must be returned from the properties
InstanceName
,ComAddress
, andLocalComAddress
.The function block must not derive from
IModule
.The section
MirrorVar
allows to mirror a variable of a module instances to its proxy instances. For this the instance path of the variable has to be declared in the definitionVariable
, which has to be stated in form of a relative (to the module instance FB) path. The following rules apply to the specified variable of the module instance FB:The variable has to be part of the module instance FB's Vars, Inputs or Outputs.
It must be defined in the module FB as well as in the proxy FB
It must be from the same type in both FBs
It must have a primitive type; thus no pointers, interfaces or structs as a whole are allowed for mirroring, but only simple types (numeric, STRING, TIME, etc.)
If the specified variables meet these conditions, they are automatically transferred as part of the RMP without the user having to worry about the transfer any further.
The section
ProxyParameter
allows to define parameter for the proxy. The following points should be taken into account:The target of the
ProxyParameter
must correspond to a parameter target of the moduleThe
variable
of the proxy module must match the type of the variable used for the module parameter. Only primitive types and enumerations are allowedThe proxy parameters are set once to the value configured in the module instance during the initialization phase of the respective application. While the application is running, these variables are not mirrored in the proxies
The name of the function block can be qualified with a namespace path.
SEC Proxies SEC Proxy ProxyFB1 FB := ProxyModule1; SEC MirrorVar : diInput Variable := diInput; END_SEC SEC ProxyParameter : InParam1 Variable := TL.Input1_Name; END_SEC END_SEC END_SEC